import React, { Component } from 'react'
import { Breadcrumb as BreadC } from 'antd';

export class Breadcrumb extends Component {
  render() {
    return (
      <BreadC style={{ margin: '16px 0' }}>
        {this.resolvePathWithBreadcrumbs(this.props.location.pathname)
          .map((b, i) => (<BreadC.Item key={i}>{b}</BreadC.Item>))}
      </BreadC>
    )
  }

  resolvePathWithBreadcrumbs = (path) => {
    return path.split('/').map(val => pathToBreadcrumb[val])
  }
}

const pathToBreadcrumb = {
  '': '首页',
  'new': '发起会议',
  'join': '加入会议',
  'my': '我的会议',
  'me': '我的信息',
  'login': '登录'
}

export default Breadcrumb
